//入口文件,加载路由

import Vue from 'vue'
import App from './App.vue'
import router from './router'

// import $ from 'jquery'

import axios from 'axios';
axios.defaults.headers.sessionid=JSON.parse(localStorage.getItem('sessionid'))
axios.defaults.baseURL='http://39.108.181.148:8000/'
Vue.prototype.$axios = axios;

import 'bootstrap'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap/dist/js/bootstrap.min.js'

// 全局导入轮播图
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/css/swiper.css'
// import vueTabbarSlide from 'vue-tabbar-slide'

Vue.config.productionTip = false
Vue.use(VueAwesomeSwiper)
// Vue.use(vueTabbarSlide)


// 密码输入框
import { PasswordInput, NumberKeyboard } from 'vant';
import 'vant/lib/password-input/style';
import 'vant/lib/number-keyboard/style';
Vue.use(PasswordInput);
Vue.use(NumberKeyboard);

// 公钥
// var pub_key = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7bPHXPybU5sReG0g8zDkXoJBj\
// aTLhXYg8ED0XFrGMi8UJkNIFbKBdnh+78rxcN25t/+Awh4PM7sD6DJDSMF4LtKDT\
// gYoc3z/I7YEkhzQ9uLgx7lcf5/zuOyOimEevLBDDHGdaC4dKeUxDJNtY+LLCYZiX\
// 22OKr+vh0dsBCRm/OwIDAQAB'
// 导入rsa加密模块
import JSEncrypt from 'jsencrypt/bin/jsencrypt'
// 定义加密函数
Vue.prototype.$jsEncrypt = function(data, pub_key){
  let encrypt = new JSEncrypt()
  encrypt.setPublicKey(pub_key)   // 设置公钥
  let en_data = encrypt.encrypt(data.toString())  //加密
  return en_data
}

// import VueCookies from 'vue-cookies'
// Vue.use(VueCookies)



new Vue({
  render: h => h(App),
  router,
}).$mount('#app')

axios.defaults.withCredentials = true
